<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
	<title>FMSynth</title>

	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">

	<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
	<script src="../build/Tone.js"></script>
	<script src="./js/tonejs-ui.js"></script>
</head>
<body>
	<style>
		tone-piano {
			margin-bottom: 10px;
		}
	</style>
	<tone-example>
		<tone-explanation label="FMSynth">
			<a href="https://tonejs.github.io/docs/FMSynth">Tone.FMSynth</a>
			is composed of two 
			<a href="https://tonejs.github.io/docs/Synth">Tone.Synths</a> 
			where one Tone.Synth modulates the frequency of a second Tone.Synth. 
		</tone-explanation>

		<tone-content>
			<tone-piano></tone-piano>
			<tone-fm-synth></tone-fm-synth>
		</tone-content>
	</tone-example>
	
	<script type="text/javascript">
		var synth = new Tone.FMSynth({
			"modulationIndex" : 12.22,
			"envelope" : {
				"attack" : 0.01,
				"decay" : 0.2
			},
			"modulation" : {
				"type" : "square"
			},
			"modulationEnvelope" : {
				"attack" : 0.2,
				"decay" : 0.01
			}
		}).toMaster();

		//bind the interface
		document.querySelector("tone-piano").bind(synth);
		document.querySelector("tone-fm-synth").bind(synth);
	</script>
</body>
</html>
